/*
 * @Author: WaterAndBin 1336263157@qq.com
 * @Date: 2023-10-07 19:55:39
 * @LastEditors: Guiter 1336263157@qq.com
 * @LastEditTime: 2023-10-08 20:28:35
 * @FilePath: \vue_shixigong\src\utils\request.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// 引入 http
import axios from "./http.js";
// 登录接口 https://www.liufengtec.com/ShixigongWeb/api/user/
// https://www.liufengtec.com/FeichengWeb/api/user/
// loginByPhoneAndVerifyCode?phone=13128913638&verifycode=123456
const login = async (params) => {
  const url = "/FeichengWeb/api/user/loginByPhoneAndVerifyCode";
  // const res = await axios.post('/FeichengWeb/api/user/loginByPhone', params)
  // return res.data
  return await axios({
    url: url,
    method: "POST",
    params: params,
  });
};
// 用户信息接口

const getAllDutyList = async (params) => {
  // return params
  const url = "/ShixiWeb/api/job/getAllDutyList";
  // const res = await axios.post(url, params)
  // return res.data
  return await axios({
    url: url,
    method: "POST",
    params: params,
  });
};
// 获取职位
const getAllJobList = async (params) => {
  // return params
  const url = "/ShixiWeb/api/job/getAllJobList";
  // const res = await axios.post(url, params)
  // return res.data
  return await axios({
    url: url,
    method: "POST",
    params: params,
  });
};
// 查询所有公司？
// https://www.liufengtec.com/ShixiWeb/api/job/
// getJobListByCompanyAndJobType?userid=3&token=BEFG6430BEFG6430BEFG6430BEFG6432&companyuserid=3&jobtype=0
const getJobListByCompany = async (params) => {
  // return params
  const url = "/ShixiWeb/api/job/getJobListByCompanyAndJobType";
  // const res = await axios.post(url, params)
  // return res.data
  return await axios({
    url: url,
    method: "POST",
    params: params,
  });
};

// 查询所有公司
//https://www.liufengtec.com/ShixiWeb/api/company/
// getAllCompanyList?userid=1&token=BEFG6430BEFG6430BEFG6430BEFG6432
const getAllCompanyList = async (params) => {
  // return params
  const url = "/ShixiWeb/api/company/getAllCompanyList";
  // const res = await axios.post(url, params)
  // return res.data
  return await axios({
    url: url,
    method: "POST",
    params: params,
  });
};

/* 企业登录入口 */
/* 手机账号密码登录 */
export function loginByPhone(params) {
  return axios({
    url: `/FeichengWeb/api/user/loginByPhone`,
    method: "post",
    params: params,
  });
}
/* 手机验证码登录 */
export function loginByPhoneAndVerifyCode(params) {
  return axios({
    url: `/FeichengWeb/api/user/loginByPhoneAndVerifyCode`,
    method: "post",
    params: params,
  });
}
/* 获取验证码 */
export function getPhoneVerifyCode(params) {
  return axios({
    url: `/FeichengWeb/api/user/getPhoneVerifyCode`,
    method: "post",
    params: params,
  });
}

export default {
  getAllCompanyList,
  login,
  getAllDutyList,
  getAllJobList,
  getJobListByCompany,
  loginByPhone,
  loginByPhoneAndVerifyCode,
  getPhoneVerifyCode,
};
